<div class="span10" style="width:90%;">
  <div class='content'>
    <%= link_to '添加设备', new_admin_terminal_order_path(terminal_group_id: @terminal_group.id), :class => 'btn btn-success ',:remote => true %>
    <%= form_tag import_admin_terminal_orders_path, :multipart => true , style: "margin:0px;margin-left:30px;display: inline" do %>
      <%= file_field_tag :file,:accept => 'text/csv' %><%= hidden_field_tag :terminal_group_id,@terminal_group.id%><%= submit_tag "工单导入" %>
    <% end %>
    <%= link_to "导出模板",export_admin_terminal_orders_path({format: :csv}.merge!(params)),:class => 'btn btn-success ' %>
  </div>
  <div class='content' style="margin-top: 10px">

  </div>
</div>

<div class="span12" style="width:90%;">
  <hr/>
  <h5>共有<%= @terminals.total_count %>条记录</h5>
</div>
<div class='span10' style="width:90%;">
    <table class="table">
      <thead>
        <tr>
          <th>设备组</th>
          <th>型号</th>
          <th>地址/车牌</th>
          <th>mac地址</th>  
          <th>终端版本号</th>
          <th>注册/签到数（累计）</th>
          <th>3G剩余流量</th>
          <th>操作</th>
        </tr>
      </thead>
      <% @terminals.each do |r| %>
        <tr id='order-<%= r.id %>'>
          <td><%= r.terminal_group.try(:group_name) %></td>
          <td>
            <%= r.dispaly_order_name %>
          </td>
          <td><%= r.dispaly_address %></td>
          <td>
            <%= r.mac %>
          </td>
          <td>
            <%=r.terminal_version.try(:version)%>
          </td>
          <td>
            <%= "#{r.total_register}/#{r.total_account_signin}" %>
          </td>
          <td><%= traffics_friendly_format r.left_traffic %></td>
          <td><%= link_to('编辑',edit_admin_terminal_order_path(r.terminal_order), remote: true) if r.terminal_order %></td>
        </tr>
      <% end %>
    </table>
    <%= paginate @terminals %>
  </div>
</div>